<template>
  <div class="admin-layout">
    <!-- 侧边栏 -->
    <aside class="admin-sidebar" :class="{ 'sidebar-collapsed': collapsed }">
      <div class="sidebar-header">
        <h1 v-if="!collapsed" class="sidebar-logo">
          <img src="/src/assets/logo.png" alt="Logo" />
          <span>视界无界管理</span>
        </h1>
        <div v-else class="sidebar-logo">
          <img src="/src/assets/logo.png" alt="Logo" />
        </div>
        <button class="sidebar-toggle" @click="toggleSidebar">
          <i :class="collapsed ? 'fa fa-angle-right' : 'fa fa-angle-left'"></i>
        </button>
      </div>
      
      <nav class="sidebar-menu">
        <ul>
          <li>
            <router-link to="/admin/dashboard" class="menu-item">
              <div class="menu-icon">
                <i class="fa fa-tachometer"></i>
              </div>
              <span v-if="!collapsed" class="menu-text">控制台</span>
              <div class="menu-indicator"></div>
            </router-link>
          </li>
          <li>
            <router-link to="/admin/users" class="menu-item">
              <div class="menu-icon">
                <i class="fa fa-users"></i>
              </div>
              <span v-if="!collapsed" class="menu-text">用户管理</span>
              <div class="menu-indicator"></div>
            </router-link>
          </li>
          <li>
            <router-link to="/admin/videos" class="menu-item">
              <div class="menu-icon">
                <i class="fa fa-video-camera"></i>
              </div>
              <span v-if="!collapsed" class="menu-text">视频管理</span>
              <div class="menu-indicator"></div>
            </router-link>
          </li>
          <li>
            <router-link to="/admin/categories" class="menu-item">
              <div class="menu-icon">
                <i class="fa fa-th-large"></i>
              </div>
              <span v-if="!collapsed" class="menu-text">分类管理</span>
              <div class="menu-indicator"></div>
            </router-link>
          </li>
          <li>
            <router-link to="/admin/tags" class="menu-item">
              <div class="menu-icon">
                <i class="fa fa-tags"></i>
              </div>
              <span v-if="!collapsed" class="menu-text">标签管理</span>
              <div class="menu-indicator"></div>
            </router-link>
          </li>
          <li>
            <router-link to="/admin/comments" class="menu-item">
              <div class="menu-icon">
                <i class="fa fa-comments"></i>
              </div>
              <span v-if="!collapsed" class="menu-text">评论管理</span>
              <div class="menu-indicator"></div>
            </router-link>
          </li>
          <li>
            <router-link to="/admin/topics" class="menu-item">
              <div class="menu-icon">
                <i class="fa fa-fire"></i>
              </div>
              <span v-if="!collapsed" class="menu-text">话题管理</span>
              <div class="menu-indicator"></div>
            </router-link>
          </li>
          <li>
            <router-link to="/admin/activities" class="menu-item">
              <div class="menu-icon">
                <i class="fa fa-calendar-alt"></i>
              </div>
              <span v-if="!collapsed" class="menu-text">活动管理</span>
              <div class="menu-indicator"></div>
            </router-link>
          </li>
          <li>
            <router-link to="/admin/animes" class="menu-item">
              <div class="menu-icon">
                <i class="fa fa-tv"></i>
              </div>
              <span v-if="!collapsed" class="menu-text">动漫管理</span>
              <div class="menu-indicator"></div>
            </router-link>
          </li>
          <li>
            <router-link to="/admin/members" class="menu-item">
              <div class="menu-icon">
                <i class="fa fa-user-circle"></i>
              </div>
              <span v-if="!collapsed" class="menu-text">会员管理</span>
              <div class="menu-indicator"></div>
            </router-link>
          </li>
          <li>
            <router-link to="/admin/statistics" class="menu-item">
              <div class="menu-icon">
                <i class="fa fa-chart-bar"></i>
              </div>
              <span v-if="!collapsed" class="menu-text">数据统计</span>
              <div class="menu-indicator"></div>
            </router-link>
          </li>
          <li v-if="adminUser && adminUser.role === 'admin'" class="admin-menu-item">
            <router-link to="/admin/settings" class="menu-item">
              <div class="menu-icon admin-icon">
                <i class="fa fa-cog"></i>
              </div>
              <span v-if="!collapsed" class="menu-text">系统设置</span>
              <div class="menu-indicator"></div>
            </router-link>
          </li>
        </ul>
      </nav>

      <!-- 侧边栏底部 -->
    </aside>
    
    <!-- 主内容区域 -->
    <main class="admin-main">
      <!-- 顶部导航栏 -->
      <header class="admin-header">
        <div class="header-left">
          <button class="mobile-toggle" @click="toggleSidebar">
            <i class="fa fa-bars"></i>
          </button>
          <h2 class="page-title">{{ currentPageTitle }}</h2>
        </div>
        <div class="header-right">
          <!-- 通知铃铛 -->
          <div class="notification-bell">
            <button class="notification-btn">
              <i class="fa fa-bell"></i>
              <span class="notification-badge">3</span>
            </button>
          </div>
          
          <!-- 用户信息 -->
          <div class="user-profile">
            <div class="profile-avatar">
              <img :src="`https://ui-avatars.com/api/?name=${adminUser?.username || 'AD'}&background=3498db&color=fff&size=40`" :alt="adminUser?.username || 'Admin'">
            </div>
            <div class="profile-info">
              <span class="user-name">{{ adminUser ? adminUser.username : '' }}</span>
              <span v-if="adminUser" class="user-role">{{ adminUser.role === 'admin' ? '超级管理员' : '编辑' }}</span>
            </div>
            <button class="logout-button" style="background: rgba(52, 152, 219, 0.15); border-color: rgba(52, 152, 219, 0.3); margin-right: 8px;" @click="goToFrontend">
              <i class="fa fa-home"></i>
              <span v-if="!collapsed" class="logout-text">返回首页</span>
            </button>
            <button class="logout-button" @click="handleLogout">
              <i class="fa fa-sign-out-alt"></i>
              <span v-if="!collapsed" class="logout-text">退出登录</span>
            </button>
          </div>
        </div>
      </header>
      
      <!-- 页面内容 -->
      <div class="admin-content">
        <router-view v-slot="{ Component }">
          <transition name="fade-slide" mode="out-in">
            <component :is="Component" />
          </transition>
        </router-view>
      </div>
    </main>
  </div>
</template>

<script>
export default {
  name: 'AdminLayout',
  data() {
    return {
      collapsed: false,
      adminUser: null,
      showNotifications: false,
    }
  },
  computed: {
    currentPageTitle() {
      return this.$route.meta.title || '管理后台'
    },
  },
  watch: {
    $route: {
      handler() {
        this.checkAuth()
      },
      immediate: true,
    },
  },
  created() {
    this.checkAuth()
  },
  methods: {
    toggleSidebar() {
      this.collapsed = !this.collapsed
      // 添加动画类
      setTimeout(() => {
        const sidebar = document.querySelector('.admin-sidebar')
        if (sidebar) {
          sidebar.classList.add('sidebar-transitioning')
          setTimeout(() => {
            sidebar.classList.remove('sidebar-transitioning')
          }, 300)
        }
      }, 10)
    },
    goToFrontend() {
      // 不清除管理员登录状态，直接跳转到首页
      this.$router.push('/')
    },
    
    handleLogout() {
      // 显示确认对话框
      if (confirm('确定要退出登录吗？')) {
        // 清除管理员登录状态
        localStorage.removeItem('adminLoggedIn')
        localStorage.removeItem('adminUser')
        // 跳转到登录页面
        this.$router.push('/admin/login')
      }
    },
    checkAuth() {
      const isLoggedIn = localStorage.getItem('adminLoggedIn') === 'true'
      if (!isLoggedIn) {
        this.$router.push('/login')
      } else {
        try {
          this.adminUser = JSON.parse(localStorage.getItem('adminUser'))
        } catch (e) {
          this.handleLogout()
        }
      }
    },
  },
}
</script>

<style scoped>
/* 全局变量 */
:root {
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --primary-color: #667eea;
  --secondary-color: #764ba2;
  --accent-color: #00ffd5;
  --sidebar-bg: #1e293b;
  --sidebar-hover: rgba(102, 126, 234, 0.2);
  --text-primary: #ffffff;
  --text-secondary: #94a3b8;
  --text-highlight: #e2e8f0;
  --header-bg: #172554;
  --content-bg: #0f172a;
  --card-bg: #1e293b;
  --border-color: rgba(51, 65, 85, 0.8);
  --shadow-light: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 10px 15px rgba(0, 0, 0, 0.2);
  --shadow-heavy: 0 15px 35px rgba(0, 0, 0, 0.3);
  --border-radius: 8px;
  --transition-fast: all 0.2s ease;
  --transition-medium: all 0.3s ease;
  --neon-glow: 0 0 10px rgba(102, 126, 234, 0.7), 0 0 20px rgba(102, 126, 234, 0.5), 0 0 30px rgba(102, 126, 234, 0.3);
  --neon-glow-accent: 0 0 10px rgba(0, 255, 213, 0.7), 0 0 20px rgba(0, 255, 213, 0.5), 0 0 30px rgba(0, 255, 213, 0.3);
  --grid-size: 40px;
}

.admin-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background-color: var(--content-bg);
  position: relative;
  z-index: 1;
}

/* 科技感覆盖层 */
.admin-layout::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.03) 0%, rgba(118, 75, 162, 0.03) 100%);
  z-index: 0;
}

/* 侧边栏样式 */
.admin-sidebar {
  width: 240px;
  background: #1a2033;
  color: var(--text-primary);
  transition: var(--transition-medium);
  position: relative;
  z-index: 100;
  overflow-y: auto;
  border-right: 1px solid #2d3748;
  background-image: 
    linear-gradient(rgba(102, 126, 234, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(102, 126, 234, 0.05) 1px, transparent 1px);
  background-size: 20px 20px;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
}

/* 侧边栏科技感边框装饰 */
.admin-sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 2px;
  background: linear-gradient(to bottom, transparent, var(--primary-color), transparent, var(--accent-color), transparent);
  animation: glowBorder 4s ease-in-out infinite;
  box-shadow: var(--neon-glow);
}

@keyframes glowBorder {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.8; }
}

.sidebar-collapsed {
  width: 70px;
}

.sidebar-transitioning {
  transition: all 0.2s ease;
}

/* 侧边栏头部 */
.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  transition: var(--transition-fast);
  position: relative;
}

.sidebar-logo::before {
  content: '';
  position: absolute;
  width: 50px;
  height: 50px;
  background: var(--primary-gradient);
  border-radius: 50%;
  filter: blur(15px);
  opacity: 0.6;
  z-index: -1;
  animation: pulseGlow 3s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

.sidebar-logo img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(102, 126, 234, 0.5);
  transition: transform 0.3s ease;
  box-shadow: var(--neon-glow);
}

.sidebar-logo:hover img {
  transform: scale(1.05);
}

.sidebar-logo span {
  margin-left: 12px;
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: #ffffff;
  background-clip: text;
}

.sidebar-toggle {
  background: rgba(102, 126, 234, 0.1);
  border: 1px solid rgba(102, 126, 234, 0.3);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 16px;
  padding: 8px;
  border-radius: 6px;
  transition: var(--transition-fast);
}

.sidebar-toggle:hover {
  background: rgba(102, 126, 234, 0.2);
  transform: scale(1.1);
  box-shadow: 0 0 8px rgba(102, 126, 234, 0.3);
}

/* 侧边栏菜单 */
.sidebar-menu {
  padding: 15px 0;
  background: linear-gradient(to bottom, var(--sidebar-bg), rgba(30, 41, 59, 0.95));
}

.sidebar-menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.menu-item {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: var(--transition-medium);
  border-radius: var(--border-radius);
  margin-bottom: 4px;
  position: relative;
  color: var(--text-secondary);
  font-weight: 500;
  border-left: 3px solid transparent;
  text-decoration: none;
  background-color: rgba(255, 255, 255, 0.02);
}

.menu-item:hover {
  color: var(--primary-color);
  background: linear-gradient(90deg, rgba(102, 126, 234, 0.2) 0%, transparent 100%);
  border-left-color: rgba(102, 126, 234, 0.5);
  padding-left: 22px;
}

.menu-item.router-link-active {
  color: var(--primary-color);
  background: linear-gradient(90deg, rgba(102, 126, 234, 0.3) 0%, transparent 100%);
  font-weight: 600;
  border-left-color: var(--primary-color);
  box-shadow: 0 0 15px rgba(102, 126, 234, 0.15);
}

.menu-item.router-link-active::before {
  opacity: 0.1;
}

.menu-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 18px;
  transition: var(--transition-fast);
  margin-right: 10px;
  position: relative;
  overflow: hidden;
}

.menu-item:hover .menu-icon,
.menu-item.router-link-active .menu-icon {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  z-index: 10;
}

/* 为每个菜单项图标设计独特的样式 */

/* 控制台 - 圆形，蓝色渐变 */
.menu-item:nth-child(1) .menu-icon {
  border-radius: 50%;
  background: linear-gradient(135deg, #45b7d1 0%, #2980b9 100%);
  color: white;
  border: 2px solid #45b7d1;
  box-shadow: 0 3px 8px rgba(69, 183, 209, 0.3);
}

/* 用户管理 - 六边形，绿色渐变 */
.menu-item:nth-child(2) .menu-icon {
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: linear-gradient(135deg, #4ecdc4 0%, #26a69a 100%);
  color: white;
  border: 2px solid #4ecdc4;
  box-shadow: 0 3px 8px rgba(78, 205, 196, 0.3);
}

/* 视频管理 - 圆角矩形，红色渐变 */
.menu-item:nth-child(3) .menu-icon {
  border-radius: 8px 16px 16px 8px;
  background: linear-gradient(135deg, #ff6b6b 0%, #e74c3c 100%);
  color: white;
  border: 2px solid #ff6b6b;
  box-shadow: 0 3px 8px rgba(255, 107, 107, 0.3);
}

/* 分类管理 - 圆角方形，黄色渐变 */
.menu-item:nth-child(4) .menu-icon {
  border-radius: 8px;
  background: linear-gradient(135deg, #feca57 0%, #f39c12 100%);
  color: white;
  border: 2px solid #feca57;
  box-shadow: 0 3px 8px rgba(254, 202, 87, 0.3);
}

/* 标签管理 - 星形，紫色渐变 */
.menu-item:nth-child(5) .menu-icon {
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  background: linear-gradient(135deg, #a55eea 0%, #7b1fa2 100%);
  color: white;
  border: 2px solid #a55eea;
  box-shadow: 0 3px 8px rgba(165, 94, 234, 0.3);
}

/* 评论管理 - 圆角对话气泡 */
.menu-item:nth-child(6) .menu-icon {
  border-radius: 20px 20px 20px 5px;
  background: linear-gradient(135deg, #667eea 0%, #4f46e5 100%);
  color: white;
  border: 2px solid #667eea;
  box-shadow: 0 3px 8px rgba(102, 126, 234, 0.3);
}

/* 话题管理 - 火焰形状 */
.menu-item:nth-child(7) .menu-icon {
  clip-path: polygon(50% 0%, 65% 30%, 95% 35%, 75% 55%, 80% 85%, 50% 70%, 20% 85%, 25% 55%, 5% 35%, 35% 30%);
  background: linear-gradient(135deg, #ff9ff3 0%, #e040fb 100%);
  color: white;
  border: 2px solid #ff9ff3;
  box-shadow: 0 3px 8px rgba(255, 159, 243, 0.3);
}

/* 活动管理 - 日历形状 */
.menu-item:nth-child(8) .menu-icon {
  border-radius: 8px 8px 2px 2px;
  background: linear-gradient(135deg, #ff6b6b 0%, #c0392b 100%);
  color: white;
  border: 2px solid #ff6b6b;
  box-shadow: 0 3px 8px rgba(255, 107, 107, 0.3);
}

/* 动漫管理 - 电视形状 */
.menu-item:nth-child(9) .menu-icon {
  clip-path: polygon(5% 10%, 95% 10%, 90% 90%, 10% 90%);
  background: linear-gradient(135deg, #1dd1a1 0%, #00b894 100%);
  color: white;
  border: 2px solid #1dd1a1;
  box-shadow: 0 3px 8px rgba(29, 209, 161, 0.3);
}

/* 会员管理 - 钻石形状 */
.menu-item:nth-child(10) .menu-icon {
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  background: linear-gradient(135deg, #48dbfb 0%, #0abde3 100%);
  color: white;
  border: 2px solid #48dbfb;
  box-shadow: 0 3px 8px rgba(72, 219, 251, 0.3);
}

/* 数据统计 - 柱状图形状 */
.menu-item:nth-child(11) .menu-icon {
  border-radius: 10px 10px 2px 2px;
  background: linear-gradient(135deg, #feca57 0%, #ff9f43 100%);
  color: white;
  border: 2px solid #feca57;
  box-shadow: 0 3px 8px rgba(254, 202, 87, 0.3);
}

/* 系统设置 - 齿轮形状 */
.menu-item:nth-child(12) .menu-icon {
  clip-path: circle(40% at 50% 50%);
  background: linear-gradient(135deg, #ff6348 0%, #ee5a24 100%);
  color: white;
  border: 2px solid #ff6348;
  box-shadow: 0 3px 8px rgba(255, 99, 72, 0.3);
}

/* 管理员设置 - 皇冠形状 */
.menu-item:nth-child(13) .menu-icon {
  clip-path: polygon(50% 0%, 63% 38%, 100% 38%, 69% 61%, 82% 100%, 50% 76%, 18% 100%, 31% 61%, 0% 38%, 37% 38%);
  background: linear-gradient(135deg, #5f27cd 0%, #4a148c 100%);
  color: white;
  border: 2px solid #5f27cd;
  box-shadow: 0 3px 8px rgba(95, 39, 205, 0.3);
}

.admin-icon {
  background: linear-gradient(135deg, rgba(231, 76, 60, 0.2) 0%, rgba(230, 126, 34, 0.2) 100%) !important;
}

.menu-item.router-link-active .admin-icon {
  background: linear-gradient(135deg, rgba(231, 76, 60, 0.3) 0%, rgba(230, 126, 34, 0.3) 100%) !important;
}

.menu-text {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
  color: #ffffff;
  transition: var(--transition-fast);
}

.menu-item:hover .menu-text,
.menu-item.router-link-active .menu-text {
  color: #ffffff;
  font-weight: 600;
}

.menu-indicator {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-color);
  opacity: 0;
  transition: var(--transition-fast);
  animation: pulse 2s infinite;
  box-shadow: 0 0 10px var(--accent-color);
}

@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.5);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 3px 12px rgba(255, 107, 107, 0.7), 0 0 15px rgba(255, 107, 107, 0.4);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.5);
  }
}

.menu-item.router-link-active .menu-indicator {
  opacity: 1;
}

/* 管理员菜单特殊样式 */
.admin-menu-item {
  margin-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* 侧边栏底部 */
.sidebar-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 15px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: #1a2033;
}

.sidebar-version {
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
}

/* 主内容区域 */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--content-bg);
  overflow: hidden;
  transition: var(--transition-medium);
  position: relative;
  z-index: 1;
  background-image: radial-gradient(circle at 25% 25%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
                    radial-gradient(circle at 75% 75%, rgba(0, 255, 213, 0.05) 0%, transparent 50%);
}

/* 顶部导航栏 */
.admin-header {
  background: #1a2033;
  padding: 0 25px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid #2d3748;
  position: relative;
  z-index: 50;
  background-image: 
    linear-gradient(rgba(102, 126, 234, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(102, 126, 234, 0.1) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* 顶部导航栏发光装饰 */
.admin-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(to right, transparent, var(--primary-color), var(--accent-color), var(--primary-color), transparent);
  opacity: 0.7;
  animation: glowTopBorder 5s ease-in-out infinite;
  box-shadow: var(--neon-glow);
}

@keyframes glowTopBorder {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.8; }
}

.header-left {
  display: flex;
  align-items: center;
}

.mobile-toggle {
  background: linear-gradient(135deg, #48dbfb 0%, #0abde3 100%);
  border: 2px solid #48dbfb;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  border-radius: 16px;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  box-shadow: 0 3px 8px rgba(72, 219, 251, 0.3);
  position: relative;
  overflow: hidden;
}

.mobile-toggle::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: slideEffect 3s infinite;
}

.mobile-toggle:hover {
  background: linear-gradient(135deg, #1a56db 0%, #4f46e5 100%);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
  border-color: #667eea;
}

.page-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  background: linear-gradient(135deg, #667eea, #00ffd5, #764ba2);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 15px rgba(102, 126, 234, 0.5), 0 0 25px rgba(0, 255, 213, 0.3);
  animation: titleGlow 3s ease-in-out infinite;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* 通知铃铛 */
.notification-bell {
  position: relative;
}

.notification-btn {
  position: relative;
  background: linear-gradient(135deg, #ff7979 0%, #eb4d4b 100%);
  border: 2px solid #ff7979;
  color: white;
  font-size: 16px;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  box-shadow: 0 3px 8px rgba(255, 121, 121, 0.3);
  position: relative;
  overflow: hidden;
}

.notification-btn::before {
  content: '';
  position: absolute;
  top: -10px;
  right: -10px;
  width: 20px;
  height: 20px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  animation: glowEffect 2s infinite;
}

.notification-btn:hover {
  background: linear-gradient(135deg, #1a56db 0%, #4f46e5 100%);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
  border-color: #667eea;
}

.notification-btn:hover {
  background: rgba(102, 126, 234, 0.2);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.notification-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5253 100%);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  min-width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(255, 107, 107, 0.5);
  animation: pulse 2s infinite;
}

@keyframes pulseNotification {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; }
}

@keyframes glowEffect {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.5); opacity: 0.5; }
}

@keyframes slideEffect {
  0%, 100% { left: -100%; }
  50% { left: 100%; }
}

/* 用户信息 */
.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(102, 126, 234, 0.1);
  padding: 8px 15px;
  border-radius: 12px;
  transition: var(--transition-medium);
  border: 1px solid rgba(102, 126, 234, 0.2);
}

.user-profile:hover {
  background: rgba(102, 126, 234, 0.2);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
  transform: translateY(-1px);
}

.profile-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--primary-color);
  box-shadow: 0 0 15px rgba(102, 126, 234, 0.5);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: white;
  font-size: 16px;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-name {
  font-weight: 600;
  color: #ffffff;
  font-size: 14px;
  text-shadow: 0 0 5px rgba(102, 126, 234, 0.3);
}

.user-role {
  font-size: 12px;
  padding: 2px 8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 10px;
  align-self: flex-start;
  box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
  font-weight: 500;
}

.logout-button {
  background: rgba(231, 76, 60, 0.15);
  border: 1px solid rgba(231, 76, 60, 0.3);
  font-size: 16px;
  cursor: pointer;
  color: #ffffff;
  transition: var(--transition-medium);
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  gap: 6px;
}

.logout-button:hover {
  background: rgba(231, 76, 60, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.logout-text {
  font-size: 14px;
  font-weight: 500;
  color: #ffffff;
}

/* 页面内容 */
.admin-content {
  flex: 1;
  padding: 25px;
  overflow-y: auto;
  transition: var(--transition-medium);
  background: var(--content-bg);
  position: relative;
  background-image: 
    linear-gradient(rgba(102, 126, 234, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(102, 126, 234, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
}

/* 页面内容层叠渐变 */
.admin-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(0, 255, 213, 0.05) 50%, rgba(118, 75, 162, 0.05) 100%);
  pointer-events: none;
}

/* 增强的过渡动画 */
.fade-slide-enter-active,
.fade-slide-leave-active {
  transition: all 0.4s cubic-bezier(0.78, 0.14, 0.15, 0.86);
}

.fade-slide-enter-from {
  opacity: 0;
  transform: translateY(20px);
}

.fade-slide-leave-to {
  opacity: 0;
  transform: translateY(-20px);
}

/* 自定义滚动条 */
.admin-sidebar::-webkit-scrollbar,
.admin-content::-webkit-scrollbar {
  width: 6px;
}

.admin-sidebar::-webkit-scrollbar-track,
.admin-content::-webkit-scrollbar-track {
  background: transparent;
}

.admin-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.admin-content::-webkit-scrollbar-thumb {
  background: rgba(102, 126, 234, 0.5);
  border-radius: 3px;
  box-shadow: 0 0 8px rgba(102, 126, 234, 0.3);
}

.admin-sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(102, 126, 234, 0.7);
}

.admin-content::-webkit-scrollbar-thumb:hover {
  background: rgba(102, 126, 234, 0.7);
  box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .mobile-toggle {
    display: flex;
  }
  
  .admin-sidebar {
    position: fixed;
    z-index: 1000;
    height: 100vh;
    transform: translateX(-100%);
  }
  
  .admin-sidebar:not(.sidebar-collapsed) {
    transform: translateX(0);
    box-shadow: var(--shadow-heavy);
  }
  
  .page-title {
    font-size: 18px;
  }
  
  .header-right {
    gap: 10px;
  }
  
  .user-profile {
    gap: 10px;
    padding: 8px 10px;
  }
  
  .profile-avatar {
    width: 36px;
    height: 36px;
  }
  
  .admin-content {
    padding: 15px;
  }
}

@media (max-width: 480px) {
  .profile-info {
    display: none;
  }
  
  .logout-text {
    display: none;
  }
  
  .admin-header {
    padding: 0 15px;
  }
}

/* 科技感动画类 */
.fade-in {
  animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.slide-in {
  animation: slideIn 0.6s ease-out;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* 标题发光动画 */
@keyframes titleGlow {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* 悬停时的缩放效果 */
.scale-hover {
  transition: transform 0.2s ease;
}

.scale-hover:hover {
  transform: scale(1.02);
}
</style>